package com.yonyou.ucf.mdf.app.isvdxq.secondpart.service;

import com.yonyou.ucf.mdf.app.isvdxq.secondpart.entity.PrelableEntity;
import com.yonyou.ucf.mdf.app.isvdxq.secondpart.mapper.impl.PrelableMapperImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PrelableService {
    @Autowired
    private PrelableMapperImpl prelableMapper;


    public PrelableEntity SelectById(String id) {
        return prelableMapper.selectById(id);
    }

    public PrelableEntity SelectByEpc(String epc, String tenantId) {
        return prelableMapper.selectByEpc(epc, tenantId);
    }

    public List<PrelableEntity> SelectByOrder(String orderid, String orderdetailid, int status, String tenantId) {
        return prelableMapper.selectByOrder(orderid, orderdetailid, status, tenantId);
    }
    public List<PrelableEntity> SelectByIds(List<String> ids, String tenantId) {
        return prelableMapper.selectByIds(ids, tenantId);
    }

    public List<PrelableEntity> SelectAll(String tenantId) {
        return prelableMapper.selectAll(tenantId);
    }

    public Integer InsertEntity(PrelableEntity entity) {
        return prelableMapper.insert(entity);
    }

    public Integer UpdateEntity(PrelableEntity entity) {
        return prelableMapper.updateByPrimaryKey(entity);
    }

    public Integer DeleteById(Integer id) {
        return prelableMapper.deleteByPrimaryKey(id);
    }

    //新增并更新
    public Integer InsertBatch(List<PrelableEntity> list) {
        if (list.size() == 0) return 0;
        long start = System.currentTimeMillis();
        int res = prelableMapper.insertBatch(list);
        long end = System.currentTimeMillis();
        System.out.println("---------------" + (start - end) + "---------------");
        return res;
    }


}
